enocean5 2.2.0
Loading...
Searching...
No Matches
enocean5


EnOcean 5 Click

EnOcean 5 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Oct 2025.
  • Type : UART type

Software Support

Example Description

This example demonstrates radio communication betweeen two EnOcean 5 Click boards. The application performs a module reset, retrieves and logs device information, sends text-based radio telegrams, and waits for received ERP1 messages.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.EnOcean5

Example Key Functions

  • enocean5_cfg_setup This function initializes Click configuration structure to initial values.
    void enocean5_cfg_setup(enocean5_cfg_t *cfg)
    EnOcean 5 configuration object setup function.
    EnOcean 5 Click configuration object.
    Definition enocean5.h:317
  • enocean5_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t enocean5_init(enocean5_t *ctx, enocean5_cfg_t *cfg)
    EnOcean 5 initialization function.
    EnOcean 5 Click context object.
    Definition enocean5.h:295
  • enocean5_send_packet This function sends TX packet from the Click context object.
    err_t enocean5_send_packet(enocean5_t *ctx)
    EnOcean 5 send packet function.
  • enocean5_read_packet This function reads RX packet from the ring buffer and stores it in the Click context object.
    err_t enocean5_read_packet(enocean5_t *ctx)
    EnOcean 5 read packet function.
  • enocean5_read_info This function reads the device information and stores it in the Click context object.
    err_t enocean5_read_info(enocean5_t *ctx)
    EnOcean 5 read info function.
  • enocean5_send_radio_message This function forms and sends the radio message telegram.
    err_t enocean5_send_radio_message ( enocean5_t *ctx, uint8_t rorg, uint8_t *data_in, uint8_t data_len );
    err_t enocean5_send_radio_message(enocean5_t *ctx, uint8_t rorg, uint8_t *data_in, uint8_t data_len)
    EnOcean 5 send radio message function.

Application Init

Initializes the logger and EnOcean 5 Click driver. Performs a hardware reset and reads module information including APP version, API version, and device identifiers.

void application_init ( void )
{
log_cfg_t log_cfg;
enocean5_cfg_t enocean5_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
enocean5_cfg_setup( &enocean5_cfg );
ENOCEAN5_MAP_MIKROBUS( enocean5_cfg, MIKROBUS_1 );
if ( UART_ERROR == enocean5_init( &enocean5, &enocean5_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf ( &logger, "\r\n>> Hardware reset.\r\n" );
if ( ENOCEAN5_OK != enocean5_reset_device ( &enocean5 ) )
{
log_error( &logger, " Hardware reset." );
for ( ; ; );
}
enocean5_parse_packet ( &enocean5 );
log_printf ( &logger, "\r\n>> Get device info.\r\n" );
if ( ENOCEAN5_OK == enocean5_read_info ( &enocean5 ) )
{
log_printf ( &logger, " < APP version: %u.%u.%u.%u\r\n",
( uint16_t ) enocean5.info.app_ver[ 0 ],
( uint16_t ) enocean5.info.app_ver[ 1 ],
( uint16_t ) enocean5.info.app_ver[ 2 ],
( uint16_t ) enocean5.info.app_ver[ 3 ] );
log_printf ( &logger, " APP description: %s\r\n", enocean5.info.app_desc );
log_printf ( &logger, " API version: %u.%u.%u.%u\r\n",
( uint16_t ) enocean5.info.api_ver[ 0 ],
( uint16_t ) enocean5.info.api_ver[ 1 ],
( uint16_t ) enocean5.info.api_ver[ 2 ],
( uint16_t ) enocean5.info.api_ver[ 3 ] );
log_printf ( &logger, " Device ID: 0x%.8LX\r\n", enocean5.info.device_id );
log_printf ( &logger, " Device version: 0x%.8LX\r\n", enocean5.info.device_ver );
}
}
@ ENOCEAN5_OK
Definition enocean5.h:340
#define ENOCEAN5_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition enocean5.h:254
err_t enocean5_reset_device(enocean5_t *ctx)
EnOcean 5 reset device function.
void application_init(void)
Definition main.c:94

Application Task

Sends "MIKROE" and "EnOcean 5" telegrams, waits for TX_DONE events, and listens for incoming ERP1 VLD telegrams, logging their content.

void application_task ( void )
{
log_printf ( &logger, "\r\n>> Sending \"%s\" radio telegram.\r\n", ( char * ) DEMO_TEXT_MESSAGE_1 );
enocean5_wait_packet_w_parse ( &enocean5, ENOCEAN5_PKT_TYPE_EVENT, ENOCEAN5_EVT_TX_DONE, ENOCEAN5_WAIT_TIME_5S );
log_printf ( &logger, "\r\n>> Waiting for radio telegram.\r\n" );
enocean5_wait_packet_w_parse ( &enocean5, ENOCEAN5_PKT_TYPE_RADIO_ERP1, ENOCEAN5_RORG_VLD, ENOCEAN5_WAIT_TIME_5S );
Delay_ms ( 1000 );
log_printf ( &logger, "\r\n>> Sending \"%s\" radio telegram.\r\n", ( char * ) DEMO_TEXT_MESSAGE_2 );
enocean5_wait_packet_w_parse ( &enocean5, ENOCEAN5_PKT_TYPE_EVENT, ENOCEAN5_EVT_TX_DONE, ENOCEAN5_WAIT_TIME_5S );
log_printf ( &logger, "\r\n>> Waiting for radio telegram.\r\n" );
enocean5_wait_packet_w_parse ( &enocean5, ENOCEAN5_PKT_TYPE_RADIO_ERP1, ENOCEAN5_RORG_VLD, ENOCEAN5_WAIT_TIME_5S );
Delay_ms ( 1000 );
}
#define ENOCEAN5_RORG_VLD
Definition enocean5.h:199
#define ENOCEAN5_PKT_TYPE_EVENT
Definition enocean5.h:81
#define ENOCEAN5_EVT_TX_DONE
Definition enocean5.h:149
#define ENOCEAN5_WAIT_TIME_5S
Definition enocean5.h:225
#define ENOCEAN5_PKT_TYPE_RADIO_ERP1
EnOcean 5 packet type bytes.
Definition enocean5.h:79
void application_task(void)
Definition main.c:148
#define DEMO_TEXT_MESSAGE_2
Definition main.c:31
#define DEMO_TEXT_MESSAGE_1
Definition main.c:30

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.